<!-- 实名认证列表 -->
<template>
	<view>
		<bg-search @search="onSearch" placeholder="请输入姓名"></bg-search>
		<view class="mt-3 bg-white" v-if="dataList.length > 0">
			<!-- <bg-cell v-for="(item, index) in dataList" :key="index" > -->
			<view v-for="(item, index) in dataList" :key="index" style="padding:24rpx;box-sizing: border-box;" >
				<view style="margin-bottom: 24rpx;">{{ item.projectName }}</view>
				<view v-for="(p, i) in item.list" :key="i" :border="i <  item.list.length - 1">
					<view class="info-area" @tap="gotoDetail(p)">
						<view class="with25">{{ p.nickName }}</view>
						<view class="with25">{{ p.sex }}</view>
						<view class="flex-1">实名时间: {{ p.authTime }}</view>
						<view>
							<u--image height='34rpx' width='24rpx'
								src='/static/images/ui/bg/black-arrow.png'></u--image>
						</view>
					</view>
				</view>

			</view>
			<!-- </bg-cell> -->
		</view>
		<u-empty v-else></u-empty>
	</view>
</template>

<script>
import { getDictShow } from '@/utils/common'
import { usersList, authUser } from '@/api/system/user'
export default {
	onNavigationBarButtonTap() {
		if (this.$store.state.user.userInfo.authStatus == 0) {
			uni.navigateTo({
				url: "/pages/enter/verify/new"
			})
		} else {
			uni.showToast({
				title: "您已实名认证",
				icon: 'none'
			})
		}

	},
	dicts: ["sys_user_sex"],
	data() {
		return {
			params: {
				realName: '',
				pageNum: 1,
				pageSize: 20
			},
			dataList: [],
		}
	},
	mounted() {
		this.getData()
		uni.$on("refresh-verify", () => {
			this.params.pageNum = 1
			this.dataList = []
			this.getData()
		})
	},
	methods: {
		getData() {
			authUser(this.params).then(res => {
				if (res.code == 200) {
					res.data.rows.forEach(r => {
						r.list.forEach(p => {
							p.sex = this.getSex(p.gender)
						})
						
					})
					this.dataList = [...this.dataList, ...res.data.rows]
				}
			})
		},
		onSearch(keyword) {
			this.params.realName = keyword
			this.params.pageNum = 1
			this.dataList = []
			this.getData()
		},
		gotoDetail(row) {
			uni.navigateTo({
				url: "/pages/enter/verify/detail?userId=" + row.userId
			})
		},
		getSex(value) {
			return getDictShow(this.dict.type.sys_user_sex, value)
		}
	}
}
</script>

<style scoped>
.info-area {
	font-size: 24rpx;
	font-family: PingFang SC, PingFang SC-Medium;
	font-weight: 500;
	text-align: left;
	color: #343434;
	display: flex;
	justify-content: space-between;
	margin-bottom: 56rpx;
}

.with25 {
	width: 20%;
}
</style>
